package com.gxar.marketdelivery.shared.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;

import java.util.Date;

/**
 * @author nice
 * @version 1.0
 * @created 2023/7/27.
 */
public class GMTMetaObjectHandler implements MetaObjectHandler {
    //插入
    @Override
    public void insertFill(MetaObject metaObject) {
        Date date = new Date();
        this.setFieldValByName("gmtCreate", date, metaObject);
        this.setFieldValByName("gmtModify", date, metaObject);
    }

    //更新
    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("gmtModify", new Date(), metaObject);
    }

}
